<template>
	<div>
		<detail-banner v-bind:detailList="detailList"
		></detail-banner>
		<detail-header></detail-header>
		<div class="content">
			<detail-list v-bind:list="detailList"></detail-list>
			<detail-listcontainer 
			v-bind:list="detailRecm"
			v-bind:listtik="detailScenictickey"
			v-on:accpetoneday="detailonedaytickey"
			v-on:accpetticky="detailtickey"></detail-listcontainer>
			<detail-listcomment v-bind:list="detailcomment"></detail-listcomment>
		</div>
	</div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import DetailListcontainer from './components/Listcontainer'
import DetailListcomment from './components/Listcomment'

import axios from 'axios'
export default {
	name: 'Detail',
	components: {
		DetailBanner,
		DetailHeader,
		DetailList,
		DetailListcontainer,
		DetailListcomment,
	},
	data () {
		return {
			detailList:[],
			detailRecm:[],
			detailScenictickey:[],
			detailcomment:[],
			showthis:'',
			list: [],
						
		}
	},
	methods: {
		getDetailInfo () {
			axios.get('/api/detail.json', {
				params: {
					id: this.$route.params.id
				}
			}).then(this.handleGetDataSucc)
		},
		detailonedaytickey () {
			axios.get('/api/detail.json')
          	.then(this.showonedaytickey)	
		},
		detailtickey () {
			axios.get('/api/detail.json')
          	.then(this.handleGetDataSucc)
		},
		showonedaytickey (res) {
			res = res.data
			if (res.ret && res.data) {
				const data = res.data
				this.detailScenictickey = data.detailonedaytickey
			}
		},
		handleGetDataSucc (res) {
			res = res.data
			if (res.ret && res.data) {
				const data = res.data
				this.showthis = parseInt(this.$route.params.id)
				if (this.showthis == 1) {
					this.detailList = data.detailList
					this.detailcomment = data.comment1
				}
				if (this.showthis == 2) {
					this.detailList = data.detailList1
					this.detailcomment = data.comment2
				}
				if (this.showthis == 3) {
					this.detailList = data.detailList2
					this.detailcomment = data.comment3
				}
				if (this.showthis == 4) {
					this.detailList = data.detailList3
					this.detailcomment = data.comment4
				}
				if (this.showthis == 5) {
					this.detailList = data.detailList4
					this.detailcomment = data.comment5
				}
				this.detailRecm = data.detailRecm
				this.detailScenictickey = data.detailScenictickey
				// this.list = data.categoryList
			}
		}
	},
	mounted () {
		this.getDetailInfo()
	},
}
</script>

<style lang='stylus' scoped>
  .content
    height: 50rem	
</style>